package com.xty;

import com.xty.factory.PhoneFactory;
import com.xty.product.products.HuaWeiPhone;
import com.xty.product.products.IPhone;
import com.xty.product.products.MidPhone;
import constant.DefaultConstant;

/**
 * Created By IntelliJ IDEA
 *
 * @author 许腾洋
 * @date 2021/11/24
 * description:
 */
public class ProductPhoneDemo {
    public static void main(String[] args) {
        //使用工厂生产手机
        PhoneFactory phoneFactory = new PhoneFactory();
        //生产华为手机
        HuaWeiPhone huaWeiPhone = (HuaWeiPhone) phoneFactory.productPhone(DefaultConstant.HUAWEI_PHONE_TYPE);
        //生产小米手机
        MidPhone midPhone = (MidPhone) phoneFactory.productPhone(DefaultConstant.MID_PHONE_TYPE);
        //生产IPone
        IPhone iPhone = (IPhone) phoneFactory.productPhone(DefaultConstant.IPHONE_TYPE);
        //生产工厂中不存在的手机类型，如oppo手机
        phoneFactory.productPhone(DefaultConstant.OPPO_PHONE_TYPE);
    }
}
